# -*- coding: utf-8 -*-
# standard
import os
import sys
from urllib.parse import quote_plus

# third
from celery import Celery


# local
_P_PATH =  os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
if _P_PATH not in sys.path:
    sys.path.append(_P_PATH)


"""
@Title:  celery 的配置 
@File: celery_conf.py
@Author: walle 2024年12日29日 06时55分20秒
@Version: 1.0.0
@Desc: 
异步调用函数的文档
https://docs.celeryq.dev/en/stable/reference/celery.app.task.html#celery.app.task.Task.apply_async
"""


MQ_SERVER_HOST = "mq.ihcc.com.cn"
MQ_SERVER_PORT = 18104
REDIS_SERVER_HOST = "61.169.129.194"
REDIS_SERVER_PORT = 4999
REDIS_PW = '8gOfXZqXGP2uczte4hRpKw4eMEhqIu7Id8ou416OtV8'
MQ_USER_NAME = "developer"
MQ_PASSWORD = "developer123"
V_HOST = ""
BROKER_URL = f'amqp://{MQ_USER_NAME}:{quote_plus(MQ_PASSWORD)}@{MQ_SERVER_HOST}:{MQ_SERVER_PORT}/{V_HOST}'
# BROKER_URL = f'redis://:{quote_plus(REDIS_PW)}@{REDIS_SERVER_HOST}:{REDIS_SERVER_PORT}/15'
CELERY_APP = Celery('tasks', 
                    broker=BROKER_URL,
                    broker_connection_retry_on_startup=True,  # 启动时重试与broker的连接
                    enable_utc=False,
                    timezone="Asia/Shanghai",
                    )



if __name__ == '__main__':
    pass